<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .hezi {
            width: 750px;
            height: 300px;
            background-color: red;
        }
    </style>
    <script>
        function adapter(){
            const dpWidth = document.documentElement.clientWidth
            const rootFontSize = (dpWidth * 100)/375
            document.documentElement.style.fontSize = rootFontSize + 'px'
        }
        adapter()
        window.onresize = adapter
    </script>
</head>
<body>
    <div class="hezi">你好</div>
    <script>
        class User {
            age = 17
            constructor(name){
                this.name = name;
            }

            changeName(name){
                this.name = name
            }
            changeAge(age){
                this.age = age
            }
        }

        function Food(name){
            this.name = name;
            console.log("你好");

            // function add(){
            //     console.log('nihao');
            // }
        }
        Food.prototype.add = function(){
            console.log('nihao');
        }
        let user = new User("安徽")
        let user1 = new User("香港")
        let food = new Food("火鸡")

        console.log(user);
        console.log(user1);
        console.log(food);
        console.log(food.add());
        console.log(user.changeName("user"))
        console.log(user1.changeName("user1"));
        console.log(user.changeAge("19"));
        console.log(user1.changeAge("29"));

    </script>
</body>
</html>



